package com.dqhl.business.activity;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.dqhl.business.Base.BaseActivity;
import com.dqhl.business.R;
import com.dqhl.business.util.Config;
import com.dqhl.business.util.Dlog;
import com.dqhl.business.util.JsonUtils;

import org.xutils.common.Callback;
import org.xutils.http.RequestParams;
import org.xutils.x;

/**
 * description: 商品详情预览
 * autour: guanluocang
 * date: 2016/11/6 16:41 
*/
public class GoodsDetailPreviewActivity extends BaseActivity implements View.OnClickListener {

    private TextView tv_goodsTopTitle;
    private ImageView iv_goodsGoBack;
    private String id;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_goods_detail_preview);
        initView();
        initData();
    }

    private void initData() {
        RequestParams params = new RequestParams(Config.management_goods_edit);
        params.addBodyParameter("id",id);
        x.http().post(params, new Callback.CommonCallback<String>() {
            @Override
            public void onSuccess(String result) {
                Dlog.e("GG商品详情"+result);
                int errCode = JsonUtils.getErrCode(result);
                if(errCode == 0){

                }else{
                    toast("暂无数据");
                }
            }

            @Override
            public void onError(Throwable ex, boolean isOnCallback) {

            }

            @Override
            public void onCancelled(CancelledException cex) {

            }

            @Override
            public void onFinished() {

            }
        });
    }

    private void initView() {
        id = getIntent().getStringExtra("id");
        iv_goodsGoBack = (ImageView) findViewById(R.id.iv_goodsGoBack);
        tv_goodsTopTitle = (TextView) findViewById(R.id.tv_goodsTopTitle);
        tv_goodsTopTitle.setText("商品详情");

        iv_goodsGoBack.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.iv_goodsGoBack:
                finish();
                break;
        }
    }
}
